< previous page page_180 next page >

Page 180
e10a6a0a59f035e870d90cca05b85fce.gif
        For j = 1 To 255
            If max_count < counts(i, j) _
                Then max_count = counts(i, j)
        Next j
    Next i

    ' Display the brightness histograms.
    For i = 0 To 2
        picHistogram(i).ScaleTop = 1.1 * max_count
        picHistogram(i).ScaleHeight = -1.2 * max_count
        picHistogram(i).ScaleLeft = -1
        picHistogram(i).ScaleWidth = 258
        For brightness = 0 To 255
            If counts(i, brightness) > 0 Then _
                picHistogram(i).Line _
                    (brightness, 0)- _
                    (brightness + 1, _
                        counts(i, brightness)), , BF
        Next brightness
    Next i

    ' Find the largest and smallest non-zero counts.
    If save_min_max Then
        For i = 0 To 2
            MinIndex(i) = 255
            For brightness = 0 To 255
                If counts(i, brightness) > 0 Then
                    MinIndex(i) = brightness
                    Exit For
                End If
            Next brightness

            MaxIndex(i) = 0
            For brightness = 255 To 0 Step -1
                If counts(i, brightness) > 0 Then
                    MaxIndex(i) = brightness 
                    Exit For 
                End If
            Next brightness
        Next i
    End If
End Sub

' Transform the image.
Private Sub TransformImage()
Dim pixels() As RGBTriplet
Dim bits_per_pixel As Integer
Dim r_mid As Integer
Dim g_mid As Integer
Dim b_mid As Integer
Dim r_scale As Single

 
< previous page page_180 next page >